<template>
  <div>
    <LoginHeader>联合登录</LoginHeader>
    <section class="container">
      <nav class="tab">
        <a
          href="javascript:;"
          :class="{ active: comCallback === 'callbackBind' }"
        >
          <i class="iconfont icon-bind" />
          <span @click="comCallback = 'callbackBind'"
            >已有小兔鲜账号，请绑定手机</span
          >
        </a>
        <a
          href="javascript:;"
          :class="{ active: comCallback === 'callbackPatch' }"
        >
          <i class="iconfont icon-edit" />
          <span @click="comCallback = 'callbackPatch'"
            >没有小兔鲜账号，请完善资料</span
          >
        </a>
      </nav>

      <!-- 动态组件实现组件切换 -->
      <component :is="comCallback" :openId="qqOpenId"></component>

      <!-- <callbackBind></callbackBind>
      <callbackPatch></callbackPatch> -->
    </section>
    <LoginFooter />
  </div>
</template>

<script>
import QC from "qc";
import LoginHeader from "./components/login-header";
import LoginFooter from "./components/login-footer";
import callbackBind from "./components/callback-bind";
import callbackPatch from "./components/callback-patch";
import { ref } from "vue";
export default {
  name: "PageCallback",
  components: { LoginHeader, LoginFooter, callbackBind, callbackPatch },
  setup() {
    const qqOpenId = ref("123");
    const comCallback = ref("callbackBind");
    if (QC.Login.check()) {
      //表示qq已经登录，再获取用户信息==openId
      QC.Login.getMe((openId) => {
        console.log(openId, 9999);
        qqOpenId.value = openId;
      });
    }
    return { comCallback, qqOpenId };
  },
};
</script>

<style scoped lang="less">
.container {
  padding: 25px 0;
}
.tab {
  background: #fff;
  height: 80px;
  padding-top: 40px;
  font-size: 18px;
  text-align: center;
  a {
    color: #666;
    display: inline-block;
    width: 350px;
    line-height: 40px;
    border-bottom: 2px solid #e4e4e4;
    i {
      font-size: 22px;
      vertical-align: middle;
    }
    span {
      vertical-align: middle;
      margin-left: 4px;
    }
    &.active {
      color: @xtxColor;
      border-color: @xtxColor;
    }
  }
}
.tab-content {
  min-height: 600px;
  background: #fff;
}
</style>
